// src/api/auth.js
import axios from 'axios';

const API_BASE = '/teach';

export const authApi = {
  // 用户登录
  login: (credentials) => {
    return axios.post(`${API_BASE}/auth/login`, credentials);
  },
  
  // 用户注册
  register: (userData) => {
    return axios.post(`${API_BASE}/auth/register`, userData);
  },
  
  // 获取当前用户信息
  getCurrentUser: () => {
    return axios.get(`${API_BASE}/auth/me`);
  },
  
  // 退出登录
  logout: () => {
    return axios.post(`${API_BASE}/auth/logout`);
  },
  
  // 刷新token
  refreshToken: () => {
    return axios.post(`${API_BASE}/auth/refresh`);
  }
};